package cn.dgfy.ssm.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.dgfy.ssm.dao.UserDao;
import cn.dgfy.ssm.dto.UserDto;
import cn.dgfy.ssm.pojo.User;
import cn.dgfy.ssm.pojo.helper.UserHelper;
import cn.dgfy.ssm.service.UserService;

@Service
public class UserServiceImpl implements UserService {
	
	@Autowired
	private UserDao userDao;
	
	@Override
	public UserDto getUserById(long id) {
		User user = userDao.selectUserById(id);
		
		if (user != null) {
			return UserHelper.toUserDto(user);
		} else {
			return null;
		}
	}	
}
